#include <iostream>

#include "predictor_pole.h"
#include "predictor_link.h"

using namespace std;

Predictor_pole::Predictor_pole( std::string id ) : Predictor_base( id )
{
  _string_type = "Pole";

  // make predictor connections
  add_input_link( new Predictor_link( PARAMETER ) ); // pole angle
  add_input_link( new Predictor_link( INPUT ) );
  _predicted_inputs.resize( _input_links.size() );

  _complexity = 10.0;
}

Predictor_pole::~Predictor_pole()
{
}

void Predictor_pole::save_state( float time )
{
  save_input( time );
}

void Predictor_pole::predict( float time )
{
  cout << " # predictor_pole: Predicting" << endl;
  _predicted_inputs[0] = _input_links[0]->get_value(); // pole
  _predicted_inputs[1] = _input_links[1]->get_value(); // actual position
}

void Predictor_pole::activate_output_link( void )
{
  //cout << "activate_output_link" << endl;
  if(_active) {
    _output_link->activate();
  } else {
    cout << "  " << _string_id << ":  De-activating output " << endl;
    _output_link->deactivate();
  }
}
